package com.xy.xymall.product.web;

import com.xy.xymall.product.service.SkuInfoService;
import com.xy.xymall.product.vo.SkuItemVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

import java.util.concurrent.ExecutionException;

/**
 * @author XY
 * @version 1.0.0
 * @ClassName ItemController.java
 * @createTime 2020年10月12日 20:14:00
 * 商品详情类
 */
@Controller
public class ItemController {

    @Autowired
    private SkuInfoService skuInfoService;

    /**
     * @Author XY
     * @Date 2020/10/12 20:16
     * @Param [skuId]
     * @Return java.lang.String
     */
    @GetMapping("/{skuId}.html")
    public String skuItem(@PathVariable("skuId") Long skuId, Model model) throws ExecutionException, InterruptedException {
        SkuItemVo skuItemVo=skuInfoService.item(skuId);
        model.addAttribute("item",skuItemVo);
        return "item";
    }
}
